package gameos.menu.hiscore;

import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.scenes.scene2d.Actor;
import com.badlogic.gdx.scenes.scene2d.ui.ImageButton;
import com.badlogic.gdx.scenes.scene2d.ui.Label;
import com.badlogic.gdx.scenes.scene2d.ui.Table;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener;
import com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent;

import gameos.core.Asset;
import gameos.core.GameOS;
import gameos.core.IScreen;
import gameos.core.IVisible;
import gameos.menu.IEntityMenu;

public class HiScoreUi extends IEntityMenu implements IVisible{

	BackBut back;	
	public HiScoreUi (GameOS game, IScreen screen) {
		super(game, screen);
		// TODO Auto-generated constructor stub
		back = new BackBut(game, screen);
	}

	Table container;
	Label score;
	
	@Override
	public void start () {
		// TODO Auto-generated method stub
		container = game.stageHelper.createTable(0, 0, game.X(838), game.Y(490));
		container.addActor(game.stageHelper.createImage(Asset.bgHiscoreRegion, 0, 0));		
		back.start();
		Label hiScore = game.stageHelper.createLabel(game.dataSave.scoreMax+"", Color.WHITE, game.X(0), game.Y(490-217));
		int xScore = (int)((game.X(838) - hiScore.getTextBounds().width)/2);
		hiScore.setX(xScore);
		Label move =  game.stageHelper.createLabel(game.dataSave.move+"", Color.WHITE, game.X(411), game.Y(490-270));;
		Label kill =  game.stageHelper.createLabel(game.dataSave.kill+"", Color.WHITE, game.X(411), game.Y(490-310));;
		container.addActor(hiScore);
		container.addActor(kill);
		container.addActor(move);
		container.addActor(back.but);
		ImageButton fb;
		fb = game.stageHelper.createImageButton2(Asset.fb_shared, Asset.fb_shared, game.X(70), game.Y(70), game.X(839-70-60), game.Y(20));
		container.addActor(fb);
		fb.addListener(new ChangeListener() {			
			@Override
			public void changed (ChangeEvent event, Actor actor) {
				// TODO Auto-generated method stub
				
			}
		});
		game.stage.addActor(container);		
		hide();
	}

	@Override
	public void stop () {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void draw () {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void update (int delayTime) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void hide () {
		// TODO Auto-generated method stub
		container.setVisible(false);
	}

	@Override
	public void show () {
		// TODO Auto-generated method stub
		container.setVisible(true);
	}

}
